package com.zerotwo.exam.user.controller;

import com.zerotwo.exam.common.core.result.Result;
import com.zerotwo.exam.user.model.UserAuthInfo;
import com.zerotwo.exam.user.service.impl.UserAuthInfoServiceImpl;
import com.zerotwo.exam.web.annotation.Inner;
import com.zerotwo.exam.web.utils.UserAuthUtil;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author 02
 * @version 1.0
 * @Date 2024/7/5
 * @Description VIEW
 */
@RestController
@RequestMapping("/user-auth")
public class UserAuthInfoController {
    @Autowired
    UserAuthInfoServiceImpl userAuthInfoService;
    @Inner
    @Operation(summary = "学生认证信息")
    @GetMapping("/info/{userId}")
    public UserAuthInfo getAuthInfo(@PathVariable Integer userId){
        return userAuthInfoService.getStudentByUserId(userId);
    }
    @Operation(summary = "学生认证信息")
    @GetMapping("/info")
    public Result getAuthInfo(){
        Integer userId = UserAuthUtil.getUserId();
        return Result.success(userAuthInfoService.getStudentByUserId(userId));
    }
}
